package com.ericsson.eritask.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ericsson.eritask.dao.ProjectDAO;
import com.ericsson.eritask.dao.UserProjectDao;
import com.ericsson.eritask.domain.Project;
import com.ericsson.eritask.dto.ProjectDTO;
import com.ericsson.eritask.service.ProjectService;

@Service
public class ProjectServiceImpl implements ProjectService{

	@Autowired
	ProjectDAO projectDAO;
	@Autowired
	UserProjectDao userProjectDAO;

	public void setProjectDAO(ProjectDAO projectDAO) {
		this.projectDAO = projectDAO;
	}

	@Override
	public List<String> getProjectList() {
		//projectDAO.getAllProjects();
		List<String> list = projectDAO.getAllProjects();
		//return l;
		System.out.println("service project"+list);

		return list;
	}

	@Override
	public List<String> getUserList(int projectId){
		
		List<String> list = userProjectDAO.getAllUsers(projectId);
		
		System.out.println("User list in service project"+list);

		return list;
	}
	
	@Override
	public List<ProjectDTO> getProjectListUser(String signum) {
//		List<String> list = projectDAO.getAllProjectsOfUser(signum);
		List<ProjectDTO> list = projectDAO.getAllProjectsOfUser(signum);
		System.out.println("service project"+list);

		return list;
	}

}
